let {readFun} = require("./readFun");

let getUserOrder  = async ()=>{
    let userList = await readFun("./user.json");
    // 将字符串转化为对象
    userList = JSON.parse(userList);
    // console.log(userList)
    let orderList = await readFun("./order.json");
    orderList = JSON.parse(orderList);
    // console.log(orderList)
    userList.forEach((item)=>{
        let obj = {
            name:item.name,
            orderList:[]
        }
        orderList.forEach(order=>{
            if(item.id === order.id){
                obj.orderList.push(order)
            }
        })
        console.log(obj)
    })
}

getUserOrder();